<template>
  <div class="apply">
    <Navigation :logoName="logoName" :routeInfo="routeInfo"></Navigation>
    <div class="formContent">
      <div class="show">
        <div class="stepLogo"></div>
        <div class="formClass">
          <h2>诉求信息</h2>
          <Form ref="formValidate" :label-width="130">
              <FormItem label="案由">
                  <Input v-model="formValidate&&formValidate.caseReason" disabled/>
              </FormItem>
              <FormItem label="申请标的">
                  <Input v-model="formValidate&&formValidate.subjectAmount" disabled/>
              </FormItem>
              <FormItem label="本金">
                  <Input v-model="formValidate&&formValidate.principal" disabled/>
              </FormItem>
              <FormItem label="利息">
                  <Input v-model="formValidate&&formValidate.interest" disabled/>
              </FormItem>
              <FormItem label="是否超标">
                  <Input v-model="formValidate&&formValidate.isExceed==1?'是':'否'" disabled/>
              </FormItem>
              
              <FormItem label="修改申请标的">
                  <Input v-model="modifyAmont" :disabled="formValidate&&formValidate.isExceed==1?false:true"/>
              </FormItem>
              <!-- <FormItem label="证据清单">
                  <Input v-model="formValidate&&formValidate.request" disabled/>
              </FormItem> -->
              <FormItem>
                  <Button @click="handleReset()" style="margin-left: 8px">上一步</Button>
                  <Button type="primary" @click="handleSubmit()">生成仲裁申请书</Button>
              </FormItem>
          </Form>
        </div>
      </div>
      
    </div>
    
  </div>
</template>

<script>
import Navigation from '../common/navigation'
import {Spin} from 'view-design';
export default {
  name: 'ApplyThirdForm',
  data(){
     return {
       logoName:'提交仲裁申请',
       routeInfo:'首页/仲裁申请/提交仲裁申请',
       modifyAmont:'',
       formValidate:{}
     }
  },
  props: {
    msg: String
  },
  methods:{
    handleSubmit () {
        if(this.formValidate&&this.formValidate.isExceed==1&&this.modifyAmont){
            this.$http.post('/api2'+this.urls.updateSubjectAmount,{caseNo:this.formValidate.caseNo,subjectAmount:this.modifyAmont}).then((result)=>{
                    
            })
        }else if(this.formValidate&&this.formValidate.isExceed==0){}else{
          this.$Message.warning('修改申请标的不能为空');
          return false;
        }
        Spin.show({
            render: (h) => {
                return h('div', [
                    h('Icon', {
                        'class': 'demo-spin-icon-load',
                        props: {
                            type: 'ios-loading',
                            size: 60
                        }
                    }),
                    h('div', 'Loading')
                ])
            }
        });
        this.$http.post('/api2'+this.urls.submitCaseInfo,{caseNo:[this.formValidate.caseNo]}).then((result)=>{
                Spin.hide();
                if(result.data.code==200){
                    this.$Message.success('生成仲裁申请书成功');
                    // setTimeout(()=>{
                        this.$router.push('/SysApplypage/Apply');
                    // },500)
                }else{
                  this.$Message.error('生成仲裁申请书失败');
                }
        });
         
         
    },
    handleReset () {
        this.$router.push({name:'ApplyThirdForm',params:{caseInfos:this.$route.params.caseInfos}});
    }
  },
  components:{Navigation},
  mounted(){
    this.$http.post('/api2'+this.urls.queryPlatformInfo,{caseNo:this.$route.params.caseInfos,submitStatus:4,pagenum:1,pagesize:8}).then((result)=>{
       
          if(result.data.code==200&&result.data.data.data.list.length>0){
            this.formValidate=result.data.data.data.list[0];
          }else{
            this.$Message.warning('请求失败');
            this.$router.push('/SysApplypage/Apply');
          }
    }) 
  }
  // mounted(){
  //   this.formValidate=JSON.parse(this.$route.params.caseInfos);
  // }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .fonttitle{
    font-size: 16px;
  }
  h2{
    color: #000;
    height: 70px;
    line-height: 70px;
  }
  .ivu-btn-default{
    margin-right: 90px;
  }
  .ivu-btn-primary {
      color: #fff;
      background-color: #2e37cb;
  }
  .ivu-form-item{
    margin-bottom: 10px;
  }
  .table{
    background: #fff;
    margin-top: 20px;
    height: 590px;
    padding: 0 20px;
  }
  .formClass{
    width: 484px;
    margin: 0 auto;
  }
  .show{
    width: 800px;
    margin: 0 auto;
    text-align: center;
    padding-top: 30px;
  }
  .btn{
    background: #2e37cb;
    color: #fff;
    line-height: 30px;
    width: 120px;
    height: 30px;
    display: inline-block;
    margin-left: 50px;
    text-align: center;
    cursor: pointer;
  }
  .btn-apply{
    background: #1aa864;
  }
  .filterCon{
    margin: 20px;
  }
  .applyTime{
    margin: 0 40px;
  }

  .stepLogo{
    background:url('../../assets/four.png') no-repeat;
    height:80px;
  }
</style>
